package chapter5;

import java.util.Scanner;

/**
 * 用正则判断手机号是否正确
 */
public class Test5_9_3 {
    public static void main(String[] args) {
        String regex = "/^[1][3,4,5,7,8][0-9]{9}$/";
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入手机号：");
        String phoNum = scan.nextLine();
        if(phoNum.matches(regex)){
            System.out.println("手机号正确！");
        }else{
            System.out.println("手机号错误");
        }
    }
}
